package chap4.Task;
import java.util.Scanner;
public class Task10 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("输入任意正整数:");
       long i=input.nextLong();
        long a,b;
        b=0;
        while (i!=0) {
           a=i%10;
           b+=a;
           i=(i-a)/10;  //或（i=i/10）也可以，目的都是缩小10倍，个位数不影响缩小的倍数
    }
        System.out.println("正整数各位和为"+b);
    }

}
